# -*- coding: utf-8 -*-
# @Time    : 2018/7/31 14:43
# @Author  : zhaoyu
# @Email   : zhaoyu@vv.cc
# @File    : quotes_spider.py
# @Software: PyCharm


import scrapy


class QuotesSpider(scrapy.Spider):
    name = "quotes"
    start_urls = [
        'http://quotes.toscrape.com/page/1/',
        'http://quotes.toscrape.com/page/2/',
    ]

    def parse(self, response):
        page = response.url.split("/")[-2]
        filename = 'quotes-%s.html' % page
        with open(filename, 'wb') as f:
            f.write(response.body)
